extends Control
@onready var red_score_value: Label = %RedScoreValue
@onready var black_score_value: Label = %BlackScoreValue
@onready var set_button: Button = %SetButton

## 初始化
func _ready() -> void:
	set_button.pressed.connect(_on_set_button_pressed) #连接设置按钮
	GlobalSignals.label_update_change_score_signal.connect(_on_change_score_signal) #连接信号
	
## 更新分数
func _on_change_score_signal(turn:BoardCommon.TURN,score:int) -> void:
	match turn:
		BoardCommon.TURN.BLACK:
			black_score_value.text=str(score)
		BoardCommon.TURN.RED:
			red_score_value.text=str(score)

## 设置按钮被按下
func _on_set_button_pressed() -> void:
	get_tree().change_scene_to_file("res://Main.tscn")
